package com.acme.mock;

import java.io.Serializable;

public abstract class AbstractAccount implements Account, Serializable{

	private double balance;
	
	public AbstractAccount(){
		this.balance = 50;
	}
	
	@Override
	public double getBalance() {
		return this.balance;
	}
	
	public void setBalance(double balance) {
		this.balance = balance;
	}

	@Override
	public void deposit(double sum) {
		this.balance += sum;
	}

	@Override
	public void withdraw(double sum) {
		if(this.balance >= sum)
			this.balance -= sum;
	}

	@Override
	public long decimalValue() {
		return Math.round(balance);
	}
	
	@Override
	public double maximumAmountToWithdraw() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int hashCode() {
		final int value = 54;
		return  (int) (value * balance);
	}

	@Override
	public String toString() {
		return "balance = " + balance;
	}

}
